{% extends "base.html" %}

{% load avatar_tags %}

{% block mystylesheet %}
    <link rel="stylesheet" href="{{ STATIC_URL }}css/styleMati.css" type="text/css" />
{% endblock %}

{% block content %}
<div class="row">
    <div class="col-md-12">
        {% with userlen=users_result|length %}
        {% with orglen=organizations_result|length  %}
        {% with toplen=topics_result|length %}
            <h1>Resultados ({{ items_result|length|add:userlen|add:orglen|add:toplen }})</h1>
        {% endwith %}
        {% endwith %}
        {% endwith %}
    </div>
</div>
<div class="row">
    <div class="col-md-12">
        <div class="panel panel-default">
            <div class="panel-heading">
                <div class="row">
                    <div class="col-md-12">
                        Productos ({{ items_result|length }})
                    </div>
                </div>
            </div>
            <div class="panel-body">
                <div class="row">
                    {% for item in items_result %}
                    <div class="col-md-2">
                        <div class="thumbnail text-center">
                            {% if item.mis_imagenes.count %}
                                <img src="{{ item.first_image_little }}" alt="Score">
                            {% else %}
                                <img src="{{ STATIC_URL }}images/298.png" alt="Score">
                            {% endif %}
                            <div class="caption">
                                <small>{{ item.nombre }}</small>
                                <p><a href="/items/item/{{ item.id }}" class="btn btn-primary" role="button">Detalle</a></p>
                            </div>
                        </div>
                    </div>
                    {% empty %}
                        <p style="margin-left: 15px;">No se encontraron productos</p>
                    {% endfor %}
                </div>
            </div>
            <!--
            <div class="panel-footer">
                <div class="row">
                    <div class="col-md-12">
                        footer
                    </div>
                </div>
            </div>
            -->
        </div>
    </div>
</div>
<div class="row">
    <div class="col-md-12">
        <div class="panel panel-default">
            <div class="panel-heading">
                <div class="row">
                    <div class="col-md-12">
                        Usuarios ({{ users_result|length }})
                    </div>
                </div>
            </div>
            <div class="panel-body">
                <div class="row">
                    {% for user in users_result %}
                    <div class="col-md-2">
                        <div class="thumbnail text-center">
                            <img src="{% avatar_url user 50 %}" alt="Avatar">
                            <div class="caption">
                                <small>{{ user.first_name }} {{ user.last_name }}</small>
                                <p><a href="/dash/logbook/{{ user.id }}" class="btn btn-success" role="button">Logbook</a></p>
                            </div>
                        </div>
                    </div>
                    {% empty %}
                        <p style="margin-left: 15px;">No se encontraron usuarios</p>
                    {% endfor %}
                </div>
            </div>
            <!--
            <div class="panel-footer">
                <div class="row">
                    <div class="col-md-12">
                        footer
                    </div>
                </div>
            </div>
            -->
        </div>
    </div>
</div>
<div class="row">
    <div class="col-md-12">
        <div class="panel panel-default">
            <div class="panel-heading">
                <div class="row">
                    <div class="col-md-12">
                        Empresas ({{ organizations_result|length }})
                    </div>
                </div>
            </div>
            <div class="panel-body">
                <div class="row">
                    {% for organization in organizations_result %}
                    <div class="col-md-2">
                        <div class="thumbnail text-center">
                            <img src="{% avatar_url organization.user 50 %}" alt="Logo" />
                            <div class="caption">
                                <small>{{ organization.razon_social }}</small>
                                <p><a href="/items/empresa/{{ organization.user.pk }}" class="btn btn-warning" role="button">Conocer</a></p>
                            </div>
                        </div>
                    </div>
                    {% empty %}
                        <p style="margin-left: 15px;">No se encontraron Empresas.</p>
                    {% endfor %}
                </div>
            </div>
            <!--
            <div class="panel-footer">
                <div class="row">
                    <div class="col-md-12">
                        footer
                    </div>
                </div>
            </div>
            -->
        </div>
    </div>
</div>
{% endblock %}
